<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="Light Year Admin V5是一个基于Bootstrap v5.1.3的后台管理系统的HTML模板。">
<title>定位 - 光年(Light Year Admin V5)后台管理系统模板</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="stylesheet" type="text/css" href="css/materialdesignicons.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.min.css">
</head>
  
<body>
<div class="container-fluid">
  
  <div class="row">
    
    <div class="col-lg-12">
      <div class="card">
        <header class="card-header"><div class="card-title">定位</div></header>
        <div class="card-body">
          
          <p>使用这些速记实用程序快速配置元素的位置。</p>

          <h6>位置值</h6>
          <p>可以使用快速定位类，但它们没有响应。</p>
          <pre>&lt;div class="position-static"&gt;...&lt;/div&gt;
&lt;div class="position-relative"&gt;...&lt;/div&gt;
&lt;div class="position-absolute"&gt;...&lt;/div&gt;
&lt;div class="position-fixed"&gt;...&lt;/div&gt;
&lt;div class="position-sticky"&gt;...&lt;/div&gt;</pre>

          <h6>排列元素</h6>
          <p>使用边缘定位实用程序轻松排列元素。格式为 <code>{property}-{position}</code>。</p>

          <p>财产是以下之一：</p>
          <ul>
            <li><code>top</code> - 垂直顶部位置</li>
            <li><code>start</code> - 水平左侧位置（在 LTR 中）</li>
            <li><code>bottom</code> - 用于垂直底部位置</li>
            <li><code>end</code> - 用于水平右侧位置（在 LTR 中）</li>
          </ul>
          <p>其中位置是以下之一：</p>
          <ul>
            <li><code>0</code> - 用于 0 边缘位置</li>
            <li><code>50</code> - 50% 边缘位置</li>
            <li><code>100</code> - 100% 边缘位置</li>
          </ul>
          <div class="border-example border-example-position-utils">
            <div class="position-relative">
              <div class="position-absolute top-0 start-0"></div>
              <div class="position-absolute top-0 end-0"></div>
              <div class="position-absolute top-50 start-50"></div>
              <div class="position-absolute bottom-50 end-50"></div>
              <div class="position-absolute bottom-0 start-0"></div>
              <div class="position-absolute bottom-0 end-0"></div>
            </div>
          </div>
          <pre>&lt;div class="position-relative"&gt;
  &lt;div class="position-absolute top-0 start-0"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-0 end-0"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-50 start-50"&gt;&lt;/div&gt;
  &lt;div class="position-absolute bottom-50 end-50"&gt;&lt;/div&gt;
  &lt;div class="position-absolute bottom-0 start-0"&gt;&lt;/div&gt;
  &lt;div class="position-absolute bottom-0 end-0"&gt;&lt;/div&gt;
&lt;/div&gt;</pre>
          
          <h6>中心元素</h6>
          <p>此外，您还可以使用转换实用程序类 <code>.translate-middle</code> 使元素居中。</p>

          <p>此类将转换 <code>translateX(-50%)</code> 和 <code>translateY(-50%)</code> 应用于元素，结合边缘定位实用程序，允许您绝对居中元素。</p>
          <div class="border-example border-example-position-utils">
            <div class="position-relative">
              <div class="position-absolute top-0 start-0 translate-middle"></div>
              <div class="position-absolute top-0 start-50 translate-middle"></div>
              <div class="position-absolute top-0 start-100 translate-middle"></div>
              <div class="position-absolute top-50 start-0 translate-middle"></div>
              <div class="position-absolute top-50 start-50 translate-middle"></div>
              <div class="position-absolute top-50 start-100 translate-middle"></div>
              <div class="position-absolute top-100 start-0 translate-middle"></div>
              <div class="position-absolute top-100 start-50 translate-middle"></div>
              <div class="position-absolute top-100 start-100 translate-middle"></div>
            </div>
          </div>
          <pre>&lt;div class="position-relative"&gt;
  &lt;div class="position-absolute top-0 start-0 translate-middle"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-0 start-50 translate-middle"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-0 start-100 translate-middle"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-50 start-0 translate-middle"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-50 start-50 translate-middle"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-50 start-100 translate-middle"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-100 start-0 translate-middle"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-100 start-50 translate-middle"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-100 start-100 translate-middle"&gt;&lt;/div&gt;
&lt;/div&gt;</pre>

          <p>通过添加 <code>.translate-middle-x</code> 或 <code>.translate-middle-y</code> 类，元素只能在水平或垂直方向定位。</p>
          <div class="border-example border-example-position-utils">
            <div class="position-relative">
              <div class="position-absolute top-0 start-0"></div>
              <div class="position-absolute top-0 start-50 translate-middle-x"></div>
              <div class="position-absolute top-0 end-0"></div>
              <div class="position-absolute top-50 start-0 translate-middle-y"></div>
              <div class="position-absolute top-50 start-50 translate-middle"></div>
              <div class="position-absolute top-50 end-0 translate-middle-y"></div>
              <div class="position-absolute bottom-0 start-0"></div>
              <div class="position-absolute bottom-0 start-50 translate-middle-x"></div>
              <div class="position-absolute bottom-0 end-0"></div>
            </div>
          </div>
          <pre>&lt;div class="position-relative"&gt;
  &lt;div class="position-absolute top-0 start-0"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-0 start-50 translate-middle-x"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-0 end-0"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-50 start-0 translate-middle-y"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-50 start-50 translate-middle"&gt;&lt;/div&gt;
  &lt;div class="position-absolute top-50 end-0 translate-middle-y"&gt;&lt;/div&gt;
  &lt;div class="position-absolute bottom-0 start-0"&gt;&lt;/div&gt;
  &lt;div class="position-absolute bottom-0 start-50 translate-middle-x"&gt;&lt;/div&gt;
  &lt;div class="position-absolute bottom-0 end-0"&gt;&lt;/div&gt;
&lt;/div&gt;</pre>

          <h6>例子</h6>
          <p>以下是这些类的一些真实示例：</p>
          <div class="border-example d-flex justify-content-around">
            <button type="button" class="btn btn-primary position-relative">
              邮件 <span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-secondary">+99 <span class="visually-hidden">未读邮件</span></span>
            </button>
            
            <button type="button" class="btn btn-dark position-relative">
              标记 <svg width="1em" height="1em" viewBox="0 0 16 16" class="position-absolute top-100 start-50 translate-middle mt-1 bi bi-caret-down-fill" fill="#212529" xmlns="http://www.w3.org/2000/svg"><path d="M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/></svg>
            </button>
            
            <button type="button" class="btn btn-primary position-relative">
              提醒 <span class="position-absolute top-0 start-100 translate-middle badge border border-light rounded-circle bg-danger p-2"><span class="visually-hidden">未读邮件</span></span>
            </button>
          </div>
          <pre>&lt;button type="button" class="btn btn-primary position-relative"&gt;
  邮件 &lt;span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-secondary"&gt;+99 &lt;span class="visually-hidden"&gt;未读邮件&lt;/span&gt;&lt;/span&gt;
&lt;/button&gt;

&lt;button type="button" class="btn btn-dark position-relative"&gt;
  标记 &lt;svg width="1em" height="1em" viewBox="0 0 16 16" class="position-absolute top-100 start-50 translate-middle mt-1 bi bi-caret-down-fill" fill="#212529" xmlns="http://www.w3.org/2000/svg"&gt;&lt;path d="M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/&gt;&lt;/svg&gt;
&lt;/button&gt;

&lt;button type="button" class="btn btn-primary position-relative"&gt;
  提醒 &lt;span class="position-absolute top-0 start-100 translate-middle badge border border-light rounded-circle bg-danger p-2"&gt;&lt;span class="visually-hidden"&gt;未读邮件&lt;/span&gt;&lt;/span&gt;
&lt;/button&gt;</pre>

          <p>您可以将这些类与现有组件一起使用来创建新组件。请记住，您可以通过向 <code>$position-values</code> 变量添加条目来扩展其功能。</p>
          <div class="border-example">
            <div class="position-relative m-4">
              <div class="progress" style="height: 1px;">
                <div class="progress-bar" role="progressbar" style="width: 50%;" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
              </div>
              <button type="button" class="position-absolute top-0 start-0 translate-middle btn btn-sm btn-primary rounded-pill" style="width: 2rem; height:2rem;">1</button>
              <button type="button" class="position-absolute top-0 start-50 translate-middle btn btn-sm btn-primary rounded-pill" style="width: 2rem; height:2rem;">2</button>
              <button type="button" class="position-absolute top-0 start-100 translate-middle btn btn-sm btn-secondary rounded-pill" style="width: 2rem; height:2rem;">3</button>
            </div>
          </div>
          <pre>&lt;div class="position-relative m-4"&gt;
  &lt;div class="progress" style="height: 1px;"&gt;
    &lt;div class="progress-bar" role="progressbar" style="width: 50%;" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;button type="button" class="position-absolute top-0 start-0 translate-middle btn btn-sm btn-primary rounded-pill" style="width: 2rem; height:2rem;"&gt;1&lt;/button&gt;
  &lt;button type="button" class="position-absolute top-0 start-50 translate-middle btn btn-sm btn-primary rounded-pill" style="width: 2rem; height:2rem;"&gt;2&lt;/button&gt;
  &lt;button type="button" class="position-absolute top-0 start-100 translate-middle btn btn-sm btn-secondary rounded-pill" style="width: 2rem; height:2rem;"&gt;3&lt;/button&gt;
&lt;/div&gt;</pre>
          
        </div>
      </div>
    </div>
        
  </div>
  
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/popper.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
</body>
</html>